package model;

public class Student extends Person {
    private Course course;

    public Student(String name) {
        super(name);
    }

    public void selectCourse(Course course) {
        this.course = course;
        System.out.println(name + "选择了课程: " + course.getCourseName());
    }

    public void dropCourse() {
        if (course != null) {
            System.out.println(name + "退选了课程: " + course.getCourseName());
            course = null;
        } else {
            System.out.println("当前没有选择课程");
        }
    }

    @Override
    public void printSchedule() {
        System.out.println("\n" + name + "的课表:");
        if (course != null) {
            course.displayInfo();
        } else {
            System.out.println("暂无课程");
        }
    }
}